package com.reading.controller;

import com.reading.pojo.DailyTasks;
import com.reading.pojo.ReadingTime;
import com.reading.service.DailyTasksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("dailyTasks")
public class DailyTasksController {

    @Autowired
    private DailyTasksService dailyTasksService;

    @RequestMapping("/findList")
    public DailyTasks findList(Integer userId){
        return dailyTasksService.findList(userId);
    }

    @RequestMapping("/updateCommentNumber")
    public void updateCommentNumber(Integer userId){
        dailyTasksService.updateCommentNumber(userId);
    }

    @RequestMapping("/updateChapterNumber")
    public void updateChapterNumber(Integer userId){
        dailyTasksService.updateChapterNumber(userId);
    }

    @RequestMapping("/updateReadingShell")
    public void updateReadingShell(Integer userId){
        dailyTasksService.updateReadingShell(userId);
    }

    @RequestMapping("/updateAll")
    public void updateAll(){
        dailyTasksService.updateAll();
    }

    @RequestMapping("/addDailyTasks")
    public void addDailyTasks(Integer id){
        dailyTasksService.addDailyTasks(id);
    }

    @RequestMapping("/updateReadingTime")
    public void updateReadingTime(@RequestBody ReadingTime readingTime){
        dailyTasksService.updateReadingTime(readingTime);
    }
}
